﻿using System;
using System.Windows.Forms;
using DevExpress.XtraTab.ViewInfo;
using DevExpress.XtraTab;
using ChamCongMain.UserControl;
using DevExpress.XtraBars.Helpers;
using DevExpress.LookAndFeel;

namespace ChamCongMain
{
    public partial class frmMain : DevExpress.XtraEditors.XtraForm
    {
        public frmMain()
        {
            InitializeComponent();
            DefaultSkin();
        }

        private void InitSkinGallery()
        {
            SkinHelper.InitSkinGallery(gallery, true);
        }

        private void DefaultSkin()
        {
            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.Skins.SkinManager.EnableMdiFormSkins();
            DevExpress.UserSkins.BonusSkins.Register();
            UserLookAndFeel.Default.UseDefaultLookAndFeel = true;
            UserLookAndFeel.Default.UseWindowsXPTheme = false;
            InitSkinGallery();
        }

        private void tabMain_CloseButtonClick(object sender, EventArgs e)
        {
            ClosePageButtonEventArgs arg = e as ClosePageButtonEventArgs;
            (arg.Page as XtraTabPage).PageVisible = false;
        }

        private void btnQuanLyCongNhan_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tabQuanLyCongNhan.PageVisible = true;
            uclCongNhan cn = new uclCongNhan();
            cn.Dock = DockStyle.Fill;
            tabQuanLyCongNhan.Controls.Add(cn);
            tabMain.SelectedTabPage = tabQuanLyCongNhan;
        }

        private void btnPhanCongCongViec_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tabPhanCongCongViec.PageVisible = true;
            uclPhanCong pc = new uclPhanCong();
            pc.Dock = DockStyle.Fill;
            tabPhanCongCongViec.Controls.Add(pc);
            tabMain.SelectedTabPage = tabPhanCongCongViec;
        }

        private void btnCongDoan_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tabCongDoan.PageVisible = true;
            uclCongDoan pc = new uclCongDoan();
            pc.Dock = DockStyle.Fill;
            tabCongDoan.Controls.Add(pc);
            tabMain.SelectedTabPage = tabCongDoan;
        }

        private void btnTinhLuong_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tabTinhLuong.PageVisible = true;
            uclTinhLuong pc = new uclTinhLuong();
            pc.Dock = DockStyle.Fill;
            tabTinhLuong.Controls.Add(pc);
            tabMain.SelectedTabPage = tabTinhLuong;
        }

        private void btnQuanLyHangSanPham_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tabNhaSanXuat.PageVisible = true;
            uclHangSanPham pc = new uclHangSanPham();
            pc.Dock = DockStyle.Fill;
            tabNhaSanXuat.Controls.Add(pc);
            tabMain.SelectedTabPage = tabNhaSanXuat;
        }

        private void btnQuanLySanPham_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tabQuanLySanPham.PageVisible = true;
            uclSanPham sp = new uclSanPham();
            sp.Dock = DockStyle.Fill;
            tabQuanLySanPham.Controls.Add(sp);
            tabMain.SelectedTabPage = tabQuanLySanPham;
        }

        private void btnDatHang_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            tabDatHang.PageVisible = true;
            uclDatHang pc = new uclDatHang();
            pc.Dock = DockStyle.Fill;
            tabDatHang.Controls.Add(pc);
            tabMain.SelectedTabPage = tabDatHang;
        }

        private void btnDonVi_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            tabDonVi.PageVisible = true;
            uclDonVi pc = new uclDonVi();
            pc.Dock = DockStyle.Fill;
            tabDonVi.Controls.Add(pc);
            tabMain.SelectedTabPage = tabDonVi;
            this.Cursor = Cursors.Default;
        }
    }
}